/*
* Poppy Game Engine - https://pgetemplate.googlecode.com/svn/
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* Copyright (c) 2008 Poppy
*/

#pragma once

#include "SystemDefines.h"
#include "CBinaryStream.h"

namespace PGESystem
{

	enum FILESTREAM_TYPE
	{
		FILE_READER = 0,
		FILE_BUFFER_READER = 1,
		FILE_WRITER = 2,
		FILE_BUFFER_RW = 3,
		FILE_NORMAL_RW = 4,
	};

	class PGESYSTEM_API CFileStream : public CBinaryStream
	{

	public:

		CFileStream( LPSTR filename, FILESTREAM_TYPE type = FILE_NORMAL_RW, DWORD buffersize = 200 );
		virtual ~CFileStream();

		inline virtual void Seek(int pos, PGE_WHENCE whence);
		inline virtual int  GetPosition();

		inline virtual int GetLength();
		inline virtual int BinaryRead(void * buffer, unsigned int size);
		inline virtual int BinaryWrite(void * buffer, unsigned int size);
		inline virtual int Read(char * buffer);
		inline virtual int Write(char * buffer);

	private:

		CBinaryStream* m_pFile;

	};

	#include "CFileStream.inl"

}
